package com.huaxin.hxmoduleworkorder.dto.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 更新工单通知记录请求 DTO（包含 ID）
 * <p>
 * 对应实体类：OrderNotification
 * 用于更新通知记录的状态或补充信息（如重试发送后更新状态）。
 * 包含主键 ID，适用于自包含请求体的更新场景。
 * 使用 jakarta.validation 进行参数校验。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
public class OrderNotificationUpdateReqDTO {
    @Schema(description = "通知记录ID，主键，用于定位更新目标", example = "notify_123")
    @NotBlank(message = "通知记录ID不能为空")
    private String id;

    @Schema(description = "工单类型：inspection（巡查）/maintenance（维修）", example = "maintenance")
    @NotBlank(message = "工单类型不能为空")
    @Size(max = 30, message = "工单类型长度不能超过30个字符")
    private String orderType;

    @Schema(description = "工单ID，关联的具体工单", example = "mnt_order_001")
    @NotBlank(message = "工单ID不能为空")
    @Size(max = 50, message = "工单ID长度不能超过50个字符")
    private String orderId;

    @Schema(description = "工单电工任务ID", example = "mnt_order_electrician_task_001")
    @Size(max = 50, message = "工单电工任务ID长度不能超过50个字符")
    private String orderElectricianTaskId;

    @Schema(description = "接收人ID（用户ID）", example = "e1001")
    @NotBlank(message = "接收人ID不能为空")
    @Size(max = 50, message = "接收人ID长度不能超过50个字符")
    private String recipientId;

    @Schema(description = "接收人角色：electrician（电工）/admin（管理员）/customer（客户）", example = "electrician")
    @NotBlank(message = "接收人角色不能为空")
    @Size(max = 30, message = "接收人角色长度不能超过30个字符")
    private String recipientRole;

    @Schema(description = "通知方式：sms（短信）/app_push（APP推送）/email（邮件）/in_system（站内信）", example = "app_push")
    @NotBlank(message = "通知方式不能为空")
    @Size(max = 30, message = "通知方式长度不能超过30个字符")
    private String notificationType;

    @Schema(description = "通知内容", example = "您有一个新的维修工单待处理")
    @NotBlank(message = "通知内容不能为空")
    @Size(max = 1000, message = "通知内容长度不能超过1000个字符")
    private String content;

    @Schema(description = "发送状态：pending（待发送）/sent（已发送）/failed（发送失败）", example = "sent")
    @NotBlank(message = "发送状态不能为空")
    @Size(max = 20, message = "发送状态长度不能超过20个字符")
    private String sendStatus;

    @Schema(description = "发送时间", example = "2025-09-02T09:15:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime sendTime;
}